package org.vectrics.recruiter.struts.tag;

/**
 * Title:        vectrics Server for Logging
 * Description:
 * Copyright:    Copyright (c) 2001
 * Company:      vectrics Software Inc.  Service is Built In
 * @author Mike Moore
 * @version 1.0
 */
import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.log4j.Category;
import org.vectrics.recruiter.GuiUtils;


public class SectionTag extends TagSupport {

	private static final long serialVersionUID = 8940604044724129840L;
	
	static private Category log = Category.getInstance(SectionTag.class);
    private String caption = "Section";
    
    
    public SectionTag() {
    	super();
    }

	public int doStartTag() throws JspException  {
        log.debug("doRender() called");
		HttpServletRequest request = (HttpServletRequest)this.pageContext.getRequest();
		
		String html = GuiUtils.getSectionHeader(request.getContextPath(), caption);
	
		JspWriter writer = pageContext.getOut();
		try {
			writer.print(html);
		}
		catch (IOException ex) {
			throw new JspException("IOException attempting to write tag to output. " + ex.getMessage());
		}
		return(EVAL_PAGE);
    }
    
	/**
	 * @return Returns the caption.
	 */
	public String getCaption() {
		return caption;
	}

	/**
	 * @param caption The caption to set.
	 */
	public void setCaption(String caption) {
		this.caption = caption;
	}

}
